package net.mikoo.seals.biz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.mikoo.seals.biz.mapper.CustosMapper;
import net.mikoo.seals.biz.service.CustosService;
import net.mikoo.seals.common.exception.ParametersException;
import net.mikoo.seals.common.model.PageModel;
import net.mikoo.seals.model.Custos;
import net.mikoo.seals.model.CustosQuery;
import net.mikoo.seals.model.Person;

@Service
public class CustosServiceImpl implements CustosService {

	@Autowired
	private CustosMapper custosMapper;

	@Override
	public PageModel<Custos> getPageByQuery(CustosQuery query) {
		if(query == null) {
			throw new ParametersException("参数错误");
		}
		
		List<Custos> datas = custosMapper.selectPageByQuery(query);
		Integer total = custosMapper.countPageByQuery(query);
		PageModel<Custos> pm = new PageModel<>(total, datas);
		
		return pm;
	}


	@Override
	public Custos getInfoByQuery(CustosQuery query) {
		if(query == null) {
			throw new ParametersException("参数错误");
		}
		return custosMapper.selectInfoByQuery(query);
	}

	@Override
	public List<Custos> getListByQuery(CustosQuery query) {
		if(query == null) {
			throw new ParametersException("参数错误");
		}
		return custosMapper.selectListByQuery(query);
	}


}
